let http = uni.$u

const BASE_URL = 'http://testdiaodianv2.tikevideos.shop'

const install = e => {
  http.http.setConfig({
    baseUrl: BASE_URL
  })
  let vkGlobalThis = vk.getGlobalObject()
  if (typeof vkGlobalThis == 'object') vkGlobalThis.api = createApi()
}
// pageNum, pageSize
const createApi = () => ({
  // 微信支付
  wxPay: params => http.post(`/order/order/wxPayTrade`, params, { 'content-type': 'application/x-www-form-urlencoded' }),
  // 发送短信
  sendSms: params => http.post(`/api/sms/send`, params, {}),
  // 短信登录
  smsLogin: params => http.post(`/api/user/smsLogin`, params, {}),
  // 初始化接口
  init: params => http.get(`/api/index/index`, params, {}),
  // 获取用户信息
  getUserInfo: params => http.get(`/api/user/getUserInfo`, params, {}),
  // 首页数据
  basanIndex: params => http.get(`/api/basan/index`, params, {}),
  // 收藏钓点
  collect: params => http.post(`/api/basan/addLikeBasan`, params, {}),
  // 收藏钓点列表
  collectList: params => http.get(`/api/basan/getLikeBasan`, params, {}),
  // 删除收藏
  collectDelete: params => http.post(`/api/basan/delLikeBasan`, params, {}),
  // 删除钓点
  deleteBasan: params => http.post(`/api/basan/delete`, params, {}),
  // 举报钓点
  reportBasan: params => http.post(`/api/report/add`, params, {}),
  // 举报类型
  reportType: params => http.get(`/api/report/getType`, params, {}),
  // 消息中心列表
  messageList: params => http.get(`/api/message/index`, params, {}),
  // 系统消息列表
  systemMessageList: params => http.get(`/api/message/index`, params, {}),
  // 获取钓点选项
  getBasanOption: params => http.get(`/api/basan_options/index`, params, {}),
  // 新增钓点选项
  addBasanOption: params => http.post(`/api/basan_options/create`, params, {}),
  // 删除钓点选项
  deleteBasanOption: params => http.post(`/api/basan_options/delete`, params, {}),
  // 获取钓点列表
  getBasanList: params => http.get(`/api/basan/getList`, params, {}),
  // 钓点详情
  getBasanDetail: params => http.get(`/api/basan/getInfo`, params, {}),
  //  退出登录
  logout: params => http.post(`/api/user/logout`, params, {}),
  // 发布钓点
  addBasan: params => http.post(`/api/basan/create`, params, {}),
  // 编辑头像
  editAvatar: params => http.post(`/api/account/editAvatar`, params, {}),
  // 编辑昵称
  editNickname: params => http.post(`/api/account/editNickname`, params, {}),
  // 获取文章列表
  getArticleDetail: params => http.get(`/api/cms.article/read`, params, {}),
  // 注销账号
  deleteAccount: params => http.post(`/api/user/delete`, params, {}),
  // 换绑手机号码
  changePhone: params => http.post(`/api/user/editMobile`, params, {}),
  // 意见反馈
  feedback: params => http.post(`/api/feedback/create`, params, {}),
  // 意见反馈列表
  feedbackList: params => http.get(`/api/feedback/index`, params, {}),
  //获取消息统计
  getMessageCount: params => http.get(`/api/notification/total`, params, {}),
  //获取消息列表
  getMessageList: params => http.get(`/api/notification/index`, params, {})
})
export default install
